﻿using CoachingOrganizer.iOS.DataSources.Tools.MoneyCalculation;
using CoachingOrganizer.iOS.Helpers;
using CoachingOrganizer.Logic.Models.Tools.MoneyCalculation;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoachingOrganizer.iOS.Controllers.Tools.MoneyCalculation
{
    public partial class OccasionalIncomesMoneyCalculationDetailsViewController : UIViewController
    {
        private readonly MoneyCalculationModel _model;

        public OccasionalIncomesMoneyCalculationDetailsViewController(IntPtr handle)
            : base(handle)
        {
            _model = ((IncomesMoneyCalculationDetailsViewController)ParentViewController).Model;
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //ItemNameView   //AutoCompleteTextField ???
            UIHelper.RegisterCellClass(ItemsView, OccasionalIncomesDataSource.CellIdentifer);
            ItemsView.Source = new OccasionalIncomesDataSource(ItemsView, this, _model);
        }

		partial void AddNewItem (NSObject sender)
		{
            _model.AddNewOccasionalIncome(ItemNameView.Text);
		}

		partial void GoBack (NSObject sender)
		{
            ParentViewController.ParentViewController.DismissViewController(true, null);
		}
    }
}
